<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php

class ConnectorViewForm extends OptionViewForm
{


    public  $userDbSource;
    public  $connectorUrl;




    
    public function rulesUserSource($type)
    {

    }

    public function rules(){
        $valid = array(
        array("userDbSource", 'required'),
        array("connectorUrl", "judgeConnect"),
        );
        return $valid;
    }

    
    public function judgeConnect(){

        if(!$this->hasErrors())
        {
            if ($this->userDbSource == "connector"){
                $prefix = substr(trim($this->connectorUrl), 0, 4);
                if(strcasecmp($prefix,   "http") !=  0){
                    $this->addError('connectorUrl','接口地址格式不正确.');
                }
            }
        }

    }

    
    public function attributeLabels()
    {         return  array(
            'connectorUrl'=>'接口地址',
        );
    }
}